package org.pz.mq;

import org.pz.vo.TaskVo;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 生产者，用于消息中心
 * */
@Component
public class ScheduleProduct {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendMessage(TaskVo taskVo){
        rabbitTemplate.convertAndSend(
                taskVo.getApplicationName() + ScheduleMqConstants.TASK_EXCHANGE_SUFFIX,
                taskVo.getApplicationName() + ScheduleMqConstants.TASK_ROUTINGKEY_SUFFIX,
                taskVo);
    }

}
